var directive = angular.module('myApp');

//用户信息展示框
directive.directive('userInfo',function(){
    return{
        restrict:'AE',
        replace:true,
        templateUrl:'./views/userInfo.html',
        link:function($scope){

        }
    }
})
//信息弹出框
directive.directive('alert',function(){
    return{
        restrict:'AE',
        replace:true,
        templateUrl:"./views/alert.html",
        link:function($scope){
            $scope.alert = function(){
                window.location.reload();
            }
            if($scope.alertInfo.show == true){
                setTimeout(function(){
                    window.location.reload();
                },1000);
            }
        }
    }
})
//失败警示框
directive.directive('failInfo',function(){
    return{
        restrict:'AE',
        template:'<div ng-show="failInfo.show" class="alert alert-danger">\
                    <strong>{{ failInfo.title }}</strong>{{ failInfo.content }}\
                    <div ng-click="close()" class="close">&times;</div>\
                    </div>',
        replace:true,
        //transclude:true,
        link:function($scope,$element){
            $scope.close = function(){
                $scope.failInfo.show = false;
            }
        }
    }
});


